'''
作业
'''
import re

# 1.
re_str = r'(\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5]\.){3}(\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])'
ip = '255.189.10.39'
print(re.fullmatch(re_str, ip))

# 2.
re_str = r'[+-]?(\d*|0\.\d*|[1-9]+\.\d*)'
num = '0.0'
print(re.fullmatch(re_str, num))

# 3.
re_str = r'[\u4e00-\u9fa5]*'
str1 = '1'
print(re.fullmatch(re_str, str1))

# 4.
re_str = r'1\d{10}'
phone = '23156123454'
print(re.fullmatch(re_str, phone))

# 5.
username = '01A456'
username_str = r'[0-9a-zA-Z_]{6,20}'
if re.fullmatch(username_str, username):
    print('ok')
else:
    print('不合法')
qq = '12519'
qq_str = r'[1-9]\d{4,11}'
if re.fullmatch(qq_str, qq, flags=re.I):
    print('ok')
else:
    print('不合法')

# 6.
re_str = r'[a-zA-Z_]+[0-9a-zA-Z_]*'
str1 = '_31561234a4'
print(re.fullmatch(re_str, str1))

# 二、

